package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.CourseCategoryTreeDto;
import com.xuecheng.content.service.CourseCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 课程分类 前端控制器
 * </p>
 *
 * @author tang
 */
@Slf4j
@RestController
@Api(value = "课程分类接口", tags = "课程分类接口")
@RequestMapping("/course-category")
public class CourseCategoryController {
    @Value("${course-category.rootId}")
    private String rootId;
    private final CourseCategoryService courseCategoryService;
    public CourseCategoryController(CourseCategoryService courseCategoryService) {
        this.courseCategoryService = courseCategoryService;
    }

    @GetMapping("/tree-nodes")
    @ApiOperation(value = "课程分类查询")
    public List<CourseCategoryTreeDto> treeNodes() {
        return courseCategoryService.selectTreeNodes(rootId);
    }
}
